﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using com.subb.WebInformation;
using WebEntities;
using WebsiteUI.Extensions;
using com.subb.ProductInformation;

namespace WebsiteUI.Controllers
{
    /// <summary>
    /// 政企服务 栏目
    /// </summary>
    public class ServiceController : Controller
    {
        [OutputCache(CacheProfile = "Cache15Mins")]
        public ActionResult Index()
        {
            WI_NewsDAL ndal = new WI_NewsDAL();
            //获取1条工程服务新闻
            List<WI_News> list1 = ndal.GetAllNews(CommonFn.GetContentID("EngServiceID"), 0, 1);
            ViewBag.EngServiceID = CommonFn.GetContentID("EngServiceID");
            ViewBag.EngServList = list1;

            //获取5条行业监管咨询新闻
            List<WI_News> list2 = ndal.GetAllNews(CommonFn.GetContentID("IndustryQueryID"), 0, 5);
            ViewBag.IndustryQueryID = CommonFn.GetContentID("IndustryQueryID");
            ViewBag.IndustryQueryList = list2;

            //获取4条示范工程新闻
            List<WI_News> list3 = ndal.GetAllNews(CommonFn.GetContentID("SampleEngID"), 0, 4);
            ViewBag.SampleEngID = CommonFn.GetContentID("SampleEngID");
            ViewBag.SampleEngList = list3;

            //获取4条应急抢修咨询新闻
            List<WI_News> list4 = ndal.GetAllNews(CommonFn.GetContentID("QuickFixID"), 0, 4);
            ViewBag.QuickFixID = CommonFn.GetContentID("QuickFixID");
            ViewBag.QuickFixList = list4;

            //获取8条环境评价新闻
            List<WI_News> list5 = ndal.GetAllNews(CommonFn.GetContentID("EnvirmentID"), 0, 8);
            ViewBag.EnvirmentID = CommonFn.GetContentID("EnvirmentID");
            ViewBag.EnvirmentList = list5;

            //获取8条规划咨询新闻
            List<WI_News> list6 = ndal.GetAllNews(CommonFn.GetContentID("PlanQueryID"), 0, 8);
            ViewBag.PlanQueryID = CommonFn.GetContentID("PlanQueryID");
            ViewBag.PlanQueryList = list6;

            //获取4条志愿者服务队新闻
            List<WI_News> list7 = ndal.GetAllNews(CommonFn.GetContentID("VolunteerID"), 0, 4);
            ViewBag.VolunteerID = CommonFn.GetContentID("VolunteerID");
            ViewBag.VolunteerList = list7;

            //获取4条法律援助新闻
            List<WI_News> list8 = ndal.GetAllNews(CommonFn.GetContentID("LawHelpID"), 0, 4);
            ViewBag.LawHelpID = CommonFn.GetContentID("LawHelpID");
            ViewBag.LawHelpList = list8;

            //获取4条产品信息
            PP_ProductDAL pdal = new PP_ProductDAL();
            int ttlCount;
            List<PP_Product> prodlist = pdal.GetAllProduct(0, 4, out ttlCount);
            ViewBag.ProdList = prodlist;

            return View();
        }

    }
}
